package com.example.hdfs;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;

import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;

public class HDFSTest {

    public static void main(String[] args) {
        Configuration config = new Configuration();
        try {
            URI uri = new URI("hdfs://10.90.100.100:8020");
            try {
                FileSystem fileSystem = FileSystem.get(uri, config, "root");
                Path src = new Path("D:/imsdk_report");
                Path dst = new Path("hdfs://10.90.100.100:8020/input");
                fileSystem.copyFromLocalFile(src,dst);

            } catch (IOException e) {
                e.printStackTrace();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }


        } catch (URISyntaxException e) {
            e.printStackTrace();
        }

    }
}
